import { useEffect, useState } from "react";
const useSocket= (user_id,server_id)=>{
    const [ws,setWs] = useState(null)
    const connect = () =>{
        const res = new WebSocket(`ws://81.70.224.2:8003/koa/ws?user_id=${user_id}&server_id=${server_id}`)
        setWs(res)
    }
    useEffect(()=>{
        connect()
    },[])
    return {ws,connect}
}
export default useSocket;